/*
 * Funny Language - a free style programming language.
 * Copyright (C) 2015 by fanguangping (fanguangping@163.com)
 * hash.h
 */

#ifndef FUNNY_HASH_H
#define FUNNY_HASH_H

#define HASHTABLE_SIZE 101

typedef struct _HashNode {
	void *element;
	struct _HashNode *next;
} HashNode;

typedef HashNode** HashTable;

HashTable alloc_hash_table();
HashNode *alloc_hash_node();

HashTable init_table();
void put_table_element(HashTable table, void *key, void *value,
		int (*HashCode)(void *key));
HashNode *get_table_element(HashTable table, void *key,
		int (*HashCode)(void *key));
void clear_table(HashTable table);
int hash_code_string(void *key);

#endif //FUNNY_HASH_H
